package cn.mutsuki.micrometer.core;

import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.config.MeterFilter;

public class MtkMeterRegistryConfiguration {
    private final MtkMeterRegistryCommonProperties commonProperties;
//    private final MtkMeterConfiguration mtkMeterConfiguration;

    public MtkMeterRegistryConfiguration(MtkMeterRegistryCommonProperties commonProperties){
        this.commonProperties = commonProperties;
//        this.mtkMeterConfiguration = mtkMeterConfiguration;
    }

    private void commonPropertiesApply(MeterRegistry.Config meterRegistryConfig){
        meterRegistryConfig.commonTags(commonProperties.getCommonTags());
        for(MeterFilter meterFilter : commonProperties.getFilterList()){
            meterRegistryConfig = meterRegistryConfig.meterFilter(meterFilter);
        }
        //meterRegistryConfig.
    }

//    private void meterConfigurationApply(MeterRegistry meterRegistry){
//        mtkMeterConfiguration.apply(meterRegistry);
//    }

    public void apply(MeterRegistry meterRegistry){
        commonPropertiesApply(meterRegistry.config());
        //meterConfigurationApply(meterRegistry);
    }
}
